jsPlumb.importDefaults({ //默认配置
	//Overlays:[
	//	["label",{cssClass:"labelcss"}]
	//]
});


var connectorPaintStyle = { //基本连接线样式
	lineWidth: 4,
	strokeStyle: "#61B7CF",
	joinstyle: "round",
	outlineColor: "white",
	outlineWidth: 2
};

var connectorHoverStyle = { // 鼠标悬浮在连接线上的样式
	lineWidth: 4,
	strokeStyle: "#216477",
	outlineWidth: 2,
	outlineColor: "white"
};

var endpointHoverStyle = { //鼠标悬停在endpoint样式
	strokeStyle: "red",
	fillStyle: "transparent",
	radius: 4,
	lineWidth: 2
};
var a = 0;
var hollowCircle = {
	/*endpoint: ["Dot", {
		radius: 8
	}], 								 //端点的形状 ,在此处无效？？？
	*/
	connectorStyle: connectorPaintStyle, //连接线的颜色，大小样式
	connectorHoverStyle: connectorHoverStyle,
	//endpointHoverStyle: endpointHoverStyle,
	paintStyle: {
		strokeStyle: "#1e8151",
		fillStyle: "transparent",
		radius: 4,
		lineWidth: 2
	}, //端点的颜色样式和形状
	//anchor: "AutoDefault",

	connector: ["Flowchart", {
		stub: [40, 60],
		gap: 10,
		cornerRadius: 5,
		alwaysRespectStubs: true
	}], //连接线的样式种类有[Bezier],[Flowchart],[StateMachine ],[Straight ]
	isSource: true, //是否可以拖动（作为连线起点）
	isTarget: true, //是否可以放置（作为连线终点）
	maxConnections: -1, // 设置每个endpoint最多可以连接几条线
	connectorOverlays: [
		["Arrow", {
			width: 10,
			length: 10,
			location: 1
		}],
		/*                //连线上增加selcet
		 ["Custom", {
			create: function(component) {
				a++;
				return $("<select id='myDropDown" + a + "' class='myDropDown' style='font-size:12px'></select>");
			},
			location: 0.2,
			id: "customOverlay"
		}]
		*/
	]
};

var loadStyle = {

}

/*
function doubleclick(id) { //修改节点名称
		$(id).dblclick(function() {
			var text = $(this).text();
			console.log(text);
			console.log($(this));
			console.log($(this).children());
			console.log($(this).html());
			$(this).html("");
			$(this).append("<input type='text' value='" + text + "' />");
			$(this).mouseleave(function() {
				$(this).html($("input[type='text']").val());
			});
		});
		
}
*/
var connects = []; 	//save()将所有连线信息保存在connects中
var blocks = []; 	//save()将所有DOM节点信息保存在blocks中
var voiceInfo = {};  //语音节点配置临时存储
var voiceInfoData;
var isStart = true;
var isEnd = true;	

$(document).ready(
	function() {
		var labname;
		var i = 0;
		var id, nodeText;
		//var voice = ['语音1', '语音2'];
		//var len = voice.length;
		var nodeId = [];
		var alreadyConnected = false;
		$("#left").children().draggable({ //左侧原型可拖动克隆事件
			helper: "clone",
			scope: "flowChart"
		});

		$("#right").droppable({ //右侧节点可拖动事件
			scope: "flowChart",
			drop: function(event, ui) {
				var left = parseInt(ui.offset.left - $(this).offset().left); //获取节点距左侧位置
				var top = parseInt(ui.offset.top - $(this).offset().top); //获取节点距上端位置
				var name = ui.draggable[0].id;
				switch (name) {
					case "node1":
						i = Math.uuid(8, 10); //生成一个8位的10进制ID
						if (!isStart) {
							alert("只能有一个开始节点");
							break;
						} else {
							isStart = false;
							id = "state_start" + i;
							nodeText = $(ui.helper).html();
							$(this).append('<div class="node" style=" "  id="' + id + '" >' + nodeText + '</div>');
							$("#" + id).css("left", left).css("top", top);
							var e = jsPlumb.addEndpoint(id, {
								anchors: "BottomCenter",
								isTarget: false,
								connectorOverlays: [
									["Arrow", {
										width: 10,
										length: 10,
										location: 1
									}] //,
									/* 连线上增加select
									["Custom", {
										create: function(component) {
											a++;
											return $("<select id='myDropDown" + a + "' class='myDropDown' style='font-size:12px'></select>");
										},
										location: 0.8,
										id: "customOverlay"
									}]
									*/
								]
							}, hollowCircle);

							jsPlumb.draggable(id);
							$("#" + id).draggable({
								containment: "parent",
							});
							//doubleclick("#" + id);
							break;
						}

					case "node2":
					case "node3":
					case "node4":
					case "node5":
						i = Math.uuid(8, 10);
						id = "state_flow" + i;
						nodeText = $(ui.helper).html();
						$(this).append("<div class='node' id='" + id + "'>" + nodeText + "</div>");
						$("#" + id).css("left", left).css("top", top);
						jsPlumb.addEndpoint(id, {
							anchors: "TopCenter"
						}, hollowCircle);
						jsPlumb.addEndpoint(id, {
							anchors: "RightMiddle"
						}, hollowCircle);
						jsPlumb.addEndpoint(id, {
							anchors: "BottomCenter"
						}, hollowCircle);
						jsPlumb.addEndpoint(id, {
							anchors: "LeftMiddle"
						}, hollowCircle);

						jsPlumb.draggable(id);
						$("#" + id).draggable({
							containment: "parent"
						});
						//doubleclick("#" + id);
						break;
					case "node6":
						i = Math.uuid(8, 10);
						id = "state_voice" + i;
						nodeText = $(ui.helper).html();
						$(this).append("<div class='node voice' id='" + id + "'>" + nodeText + "</div>");
						$("#" + id).css("left", left).css("top", top);
						jsPlumb.addEndpoint(id, {
							anchors: "TopCenter"
						}, hollowCircle);
						jsPlumb.addEndpoint(id, {
							anchors: "RightMiddle"
						}, hollowCircle);
						jsPlumb.addEndpoint(id, {
							anchors: "BottomCenter"
						}, hollowCircle);
						jsPlumb.addEndpoint(id, {
							anchors: "LeftMiddle"
						}, hollowCircle);

						jsPlumb.draggable(id);
						$("#" + id).draggable({
							containment: "parent"
						});
						break;
					case "node7":
						i = Math.uuid(8, 10);
						if (!isEnd) {
							alert("只能有一个结束节点");
							break;
						} else {
							isEnd = false;
							id = "state_end" + i;
							nodeText = $(ui.helper).html();
							$(this).append('<div class="node" style=""  id="' + id + '" >' + nodeText + '</div>');
							$("#" + id).css("left", left).css("top", top);
							jsPlumb.addEndpoint(id, {
								anchors: "TopCenter",
								isSource: false
							}, hollowCircle);

							jsPlumb.draggable(id);
							$("#" + id).draggable({
								containment: "parent"
							});
							//doubleclick("#" + id);
							break;
						}
				}
			    //jsPlumb.repaintEverything(); //重绘所有，导入图后再次从左侧拖拽会导致错误？？？？？？？
			}
		});

		$("#right").on("mouseenter", ".node", function() { //鼠标移入节点事件
			$(this).append('<img src="/my/img/close.png" class="close"/>');
			var nodeContext = $(this).context.innerText; //用append()方法插入close图片
			$(".close").css("left", 50).css("top", -6);
		});

		$("#right").on("mouseleave", ".node", function() { //鼠标离开节点事件
			$(".close").remove(); //用remove()将append的colse图片删除
		});

		$("#right").on("click", ".close", function() { //单击红叉事件，删除节点
			var p = $(this).parent(); //获取父元素，即.node节点
			var str = $(this).parent().attr("id"); //获取父元素id
			if (confirm("确定删除节点吗?")) {
				if (str.indexOf("start") != -1) { //删除开始节点,置isStart为true
					isStart = true;
				}
				if (str.indexOf("end") != -1) {
					isEnd = true; //删除结束节点,置isEnd为true
				}
				//$(this).parent().remove();  		   //注意：由于鼠标离开事件remove了关闭图片，所以此处再使用$(this).parent()找不到父节点
				p.remove(); //删除父节点
				jsPlumb.removeAllEndpoints(str); //删除父节点的所有连接 
				//jsPlumb.repaintEverything();         //重绘所有
			}
		});

		$("#right").on("mousedown", ".node", function(e) { //节点鼠标右击事件，右击e.which值为3
			console.log(e.which);
			console.log($("#right>.node"));
		});

		var timer = null;
		$("#right").on("click", ".node>.nodeImg,.node>.text", function(e) { //鼠标单击节点事件，更改节点名
			clearTimeout(timer);
			var oldText = $(this).parent().children().text(); //点击节点上图片或者文字获取到节点文字
			var textDiv = $(this).parent().children()[1];
			timer = setTimeout(function() { //使用setTimeout()解决单击与双击冲突	
				var newText = prompt("请输入新节点名", oldText);
				if (newText) { //点击确定
					$(textDiv).text(newText);
				} else { //点击取消
					$(textDiv).text(oldText);
				}
			}, 300);

		});

	
		$("#right").on("dblclick", ".node.voice", function(e) { //语音节点双击事件，打开语音配置模态框
			clearTimeout(timer);
			console.log(voiceInfo);
			var text = $(this).text();
			var voiceId = $(this).attr("id");
			if (voiceInfo[voiceId]) { //如果该节点语音配置已经存在,显示已存在的值
				console.log("yizai");
				$("#dialogSelect").val(voiceInfo[voiceId].voiceType);
				$("#loopSelect").val(voiceInfo[voiceId].voiceLoop);
				$("#timeout").val(voiceInfo[voiceId].timeOut);
				$("#check").prop("checked", voiceInfo[voiceId].isChceked);
			} else { //不存在，设置默认显示值
				console.log("buzai");
				$("#dialogSelect").val("none");
				$("#loopSelect").val("1");
				$("#timeout").val("");
				$("#check").prop("checked", false); //注意：1.6+的jQuery要用prop，不能用attr,兼容性和稳定性问题会导致属性改变了，但显示状态有问题
			}
			$("#voiceDialog").dialog("option", "_button", $(this)); //模态框传参
			$("#voiceDialog").dialog("open"); //打开模态框

		});

		$("#voiceDialog").dialog({ //模态框
			autoOpen: false, //默认不显示模态框
			resizable: false,
			height: 140,
			modal: true,
			buttons: {
				"确定": function() { //点击确定
					var parent = $(this).dialog("option", "_button");
					var voiceId = parent.attr("id");
					var voiceType = $("#dialogSelect").val();
					var voiceLoop = $("#loopSelect").val();
					var timeOut = $("#timeout").val();
					var isChceked = $("#check").is(':checked');
					if (!voiceInfo[voiceId]) { //voicdInfo[voiceId]不存在,则加入voiceInfo
						voiceInfo[voiceId] = {};
						voiceInfo[voiceId].voiceType = voiceType;
						voiceInfo[voiceId].voiceLoop = voiceLoop;
						voiceInfo[voiceId].timeOut = timeOut;
						voiceInfo[voiceId].isChceked = isChceked;
						console.log("xinzeng");
					} else { //已存在则修改
						voiceInfo[voiceId].voiceType = $("#dialogSelect").val();
						voiceInfo[voiceId].voiceLoop = $("#loopSelect").val();
						voiceInfo[voiceId].timeOut = $("#timeout").val();
						voiceInfo[voiceId].isChceked = $("#check").is(':checked');
						console.log("xiugai");
					}
					$(parent.children()[1]).text(voiceType);
					$(this).dialog("close");
				},
				"取消": function() { //点击取消
					$(this).dialog("close");
				}
			}
		});
			
		var connOverlay = jsPlumb.bind("connection", function(info, originalEvent) { //连线事件
			var sourceTarget = {};
			//console.log(info.connection.getOverlays().customOverlay.getElement().id);
			/*var connectionOverlayId = info.connection.getOverlays().customOverlay.getElement().id; //获取select的id */

			if (originalEvent) { //拖拽连线时添加标签
				/*	$("#" + connectionOverlayId).prepend("<option value='none'>请选择</option>");
					voice.forEach(function(item) {
						$("#" + connectionOverlayId).append("<option value='" + item + "'>" + item + "</option>");
					})
				*/
				if (info.connection.sourceId == info.connection.targetId) { //自身不能连接自身
					jsPlumb.detach(info.connection);
					alert("不能连接自己！");
				} else if (nodeId.length == 0) { //nodeId中还未存储连接信息
					labname = prompt("请输入连线标签", "");
					if (labname) {
						info.connection.setLabel(labname);
					} else {
						info.connection.setLabel(".....");
					}
					sourceTarget.sourceId = info.connection.sourceId;
					sourceTarget.targetId = info.connection.targetId;
					nodeId.push(sourceTarget);
					console.log(nodeId);
				} else { //nodeId中已经有存储连接信息，则进行对比
					var sourceId = info.connection.sourceId;
					var targetId = info.connection.targetId;
					nodeId.forEach(function(item) {
						if ((item.sourceId == sourceId && item.targetId == targetId) || (item.targetId == sourceId && item.sourceId == targetId)) {
							alreadyConnected = true;
						}
					});
					if (alreadyConnected) { //两节点已经连接
						jsPlumb.detach(info.connection);
						alert("两节点已有连线！");
						alreadyConnected = false;
					} else { //两节点未连接
						labname = prompt("请输入连线标签", "");
						if (labname) {
							info.connection.setLabel(labname);
						} else {
							info.connection.setLabel(".....");
						}
						sourceTarget.sourceId = info.connection.sourceId;
						sourceTarget.targetId = info.connection.targetId;
						nodeId.push(sourceTarget);
					}
				}
			} else { //导入数据自动连线时originalEvent为false

			}
		});

		jsPlumb.bind("dblclick", function(conn, originalEvent) { //双击连线事件，删除连线
			var connSourceId  = conn.sourceId;
			var connTargetId = conn.targetId;
			if (confirm("确定删除连线吗")){
				jsPlumb.detach(conn);                           //删除连线
				nodeId.forEach(function(item,index){
					if(item.sourceId == connSourceId && item.targetId == connTargetId){
						nodeId.splice(index,1);                 //删除nodeId中存储的对应值
					}
				});
			}
		});
		
		$("#right").on("click", 'div.jsplumb-overlay', function(connOverlay) { //连线标签单击事件，修改连线标签
			var currentLabel = connOverlay.currentTarget._jsPlumb.label;
			labname = prompt("修改标签", currentLabel);
			if (labname) {
				connOverlay.currentTarget._jsPlumb.setLabel(labname);
			} else if (labname == '') {
				connOverlay.currentTarget._jsPlumb.setLabel(".....");
			}
		});

		/*  进入页面则导入	
				jsPlumb.ready(function() {
		    		load();
		       	})
		*/
	});
	var IVRdata = {};
function save() { //保存流程图信息，getAllConnentions()获取所有连接，$.each()遍历
	connects = [];
	blocks = [];
	console.log(voiceInfo);  
	$.each(jsPlumb.getAllConnections(), function(idx, connection) {
		var SourceEndpoint = connection.endpoints[0].anchor.type; //获取源的endpoint位置
		var TargetEndpoint = connection.endpoints[1].anchor.type; //获取目标的endpoint位置
		var labelText = connection.getLabel(); //获取连线标签
		//var b =connection.getOverlays();
		//console.log(b.customOverlay._jsPlumb.div.value);        //获取线上select值
		//var ConnectionSelectText = connection.getOverlays().customOverlay._jsPlumb.div.value;
		connects.push({
			ConnectionId: connection.id,
			SourceId: connection.sourceId,
			TargetId: connection.targetId,
			SourceEndpoint: SourceEndpoint,
			TargetEndpoint: TargetEndpoint,
			SourceText: connection.source.textContent,
			TargetText: connection.target.textContent,
			ConnectionLabelText: labelText,
			//ConnectionSelectText: ConnectionSelectText
		});
	});
	//console.log(connects);
	$("#right .node").each(function(idx, elem) {
		var $elem = $(elem);
		//console.log($elem);
		//console.log($elem.html());
		//console.log($elem.context.innerText);
		var elementId = $elem.attr('id');
		var voiceData ;
		if(voiceInfo[elementId]){
			voiceData = voiceInfo[elementId];
		}else{
			voiceData = {};
		}
		blocks.push({
			BlockId: $elem.attr('id'),
			BlockText: $elem.context.innerText,
			BlockContent: $elem.html(),
			BlockX: parseInt($elem.css("left"), 10),
			BlockY: parseInt($elem.css("top"), 10),
			BlockOtherInfo: voiceData
		});
	});
	console.log(blocks);
	voiceInfoData = voiceInfo;
	
	IVRdata.connectsData = connects;
	IVRdata.blocksData = blocks;
	IVRdata.voiceInfoData = voiceInfoData;
	//var serliza = JSON.stringify(connects) + "&" + JSON.stringify(blocks) ;
	//console.log(serliza);
	//var obj = JSON.parse(str);          //由JSON字符串转换为JSON对象
	//var last=JSON.stringify(obj);       //将JSON对象转化为JSON字符
};


function load() { /*此处的数据应该是从后台读取的*/
	if ($("#right >.node").length > 0) { //获取页面#right中已有节点数量,当已经有节点则不导入
		return;
	} else {
		console.log(IVRdata);
		var htmlText = "";
		var conn = "";
		var connectsData = IVRdata.connectsData;  //连线信息
		var blockData = IVRdata.blocksData;       //节点信息
		voiceInfo = IVRdata.voiceInfoData;        //所有语音节点配置信息
		/*
		var connectsData = [
		{
			ConnectionId: "con_39",
			SourceId: "state_flow34260585",
			TargetId: "state_flow00407372",
			SourceEndpoint: "RightMiddle",
			TargetEndpoint: "LeftMiddle",
			SourceText: "菜单",
			TargetText: "队列",
			ConnectionLabelText: "3",
			//ConnectionSelectText: "请选择"
		}, {
			ConnectionId: "con_44",
			SourceId: "state_flow00407372",
			TargetId: "state_flow42182803",
			SourceEndpoint: "RightMiddle",
			TargetEndpoint: "LeftMiddle",
			SourceText: "队列",
			TargetText: "应答",
			ConnectionLabelText: "4",
			//ConnectionSelectText: "语音1"
		}, {
			ConnectionId: "con_57",
			SourceId: "state_start18393766",
			TargetId: "state_flow98338379",
			SourceEndpoint: "BottomCenter",
			TargetEndpoint: "LeftMiddle",
			SourceText: "开始",
			TargetText: "语音",
			ConnectionLabelText: "1",
			//ConnectionSelectText: "语音2"
		}, {
			ConnectionId: "con_62",
			SourceId: "state_flow98338379",
			TargetId: "state_flow34260585",
			SourceEndpoint: "RightMiddle",
			TargetEndpoint: "LeftMiddle",
			SourceText: "语音",
			TargetText: "菜单",
			ConnectionLabelText: "2",
			//ConnectionSelectText: "请选择"
		}, {
			ConnectionId: "con_75",
			SourceId: "state_flow34260585",
			TargetId: "state_flow32048033",
			SourceEndpoint: "RightMiddle",
			TargetEndpoint: "LeftMiddle",
			SourceText: "菜单",
			TargetText: "拨号",
			ConnectionLabelText: "5",
			//ConnectionSelectText: "请选择"
		}
		, {
			ConnectionId: "con_82",
			SourceId: "state_flow32048033",
			TargetId: "state_end37058833",
			SourceEndpoint: "RightMiddle",
			TargetEndpoint: "TopCenter",
			SourceText: "拨号",
			TargetText: "结束",
			ConnectionLabelText: "6",
			//ConnectionSelectText: "请选择"
		}
		]
		var blockData = [{
			BlockId: "state_start18393766",
			BlockText: "开始",
			BlockContent: "<img src='img/huru.png' class='nodeImg'><div class='text'>开始</div>",
			BlockX: 18,
			BlockY: 18
		}, {
			BlockId: "state_flow42182803",
			BlockText: "应答",
			BlockContent: "<img src='img/jieting.png' class='nodeImg'><div class='text'>应答</div>",
			BlockX: 796,
			BlockY: 25
		}, {
			BlockId: "state_flow34260585",
			BlockText: "菜单",
			BlockContent: "<img src='img/caidan.png' class='nodeImg'><div class='text'>菜单</div>",
			BlockX: 310,
			BlockY: 109
		}, {
			BlockId: "state_flow00407372",
			BlockText: "队列",
			BlockContent: "<img src='img/duilie.png' class='nodeImg'><div class='text'>队列</div>",
			BlockX: 578,
			BlockY: 111
		}, {
			BlockId: "state_flow98338379",
			BlockText: "语音",
			BlockContent: "<img src='img/ring.png' class='nodeImg'><div class='text'>语音</div>",
			BlockX: 125,
			BlockY: 112
		}
		, {
			BlockId: "state_flow32048033",
			BlockText: "拨号",
			BlockContent: "<img src='img/huchu.png' class='nodeImg'><div class='text'>拨号</div>",
			BlockX: 508,
			BlockY: 248
		}
		, {
			BlockId: "state_end37058833",
			BlockText: "结束",
			BlockContent: "<img src='img/guaduan.png' class='nodeImg'><div class='text'>结束</div>",
			BlockX: 760,
			BlockY: 352
		}
		]*/

		//console.log(connectsData);
		//console.log(blockData);

		if (blockData.length > 0) {
			blockData.forEach(function(item) {
				var blockId = item.BlockId;
				if(blockId.indexOf("start") != -1 || blockId.indexOf("end") != -1 ){ //是开始或者结束节点
					
				//if (item.BlockText == "开始" || item.BlockText == "结束") {
					htmlText = "<div class='node ' id='" + item.BlockId + "'style='left:" + item.BlockX + "px;top:" + item.BlockY + "px;' >" + item.BlockContent + "</div>";
					$("#right").append(htmlText);
					if (blockId.indexOf("start") != -1 ) {    //开始节点
						isStart = false;
						jsPlumb.addEndpoint(item.BlockId, {
							anchors: "BottomCenter",
							isTarget: false,
						}, hollowCircle);
					}
					if (blockId.indexOf("end") != -1 ) {      //结束节点
						isEnd = false;
						jsPlumb.addEndpoint(item.BlockId, {
							anchors: "TopCenter",
							isSource: false
						}, hollowCircle);
					}

				} else {
					if(blockId.indexOf("voice") != -1){     //语音节点
						htmlText = "<div class='node voice' id='" + item.BlockId + "'style='left:" + item.BlockX + "px;top:" + item.BlockY + "px;' >" + item.BlockContent + "</div>";	
					}else{                                  //其它节点
						htmlText = "<div class='node' id='" + item.BlockId + "'style='left:" + item.BlockX + "px;top:" + item.BlockY + "px;' >" + item.BlockContent + "</div>";
				    }
					$("#right").append(htmlText);
					jsPlumb.addEndpoint(item.BlockId, {
						anchors: "TopCenter"
					}, hollowCircle);
					jsPlumb.addEndpoint(item.BlockId, {
						anchors: "RightMiddle"
					}, hollowCircle);
					jsPlumb.addEndpoint(item.BlockId, {
						anchors: "BottomCenter"
					}, hollowCircle);
					jsPlumb.addEndpoint(item.BlockId, {
						anchors: "LeftMiddle"
					}, hollowCircle);

				}
				jsPlumb.draggable(item.BlockId);
				$("#" + item.BlockId).draggable({
					containment: "parent",
				});
				//doubleclick("#" + item.BlockId);
			})

			connectsData.forEach(function(ite) { //导入数据时绘图连线
				jsPlumb.connect({
					source: ite.SourceId,
					target: ite.TargetId,
					anchors: [ite.SourceEndpoint, ite.TargetEndpoint],
					endpoint: ["Blank", { //端点样式，此处设置为空白
						strokeStyle: "#1e8151",
						fillStyle: "transparent",
						radius: 4,
						lineWidth: 2
					}],
					//endpointHoverStyle: endpointHoverStyle,
					connector: ["Flowchart", {
						stub: [40, 60],
						gap: 10,
						cornerRadius: 5,
						alwaysRespectStubs: true
					}], //此处的hoverStyle和paintStyle参数名与endpoint不太一样
					hoverPaintStyle: connectorHoverStyle, //连线hoverStyle
					paintStyle: connectorPaintStyle, //连线Style

					overlays: [
						["Arrow", {
							width: 10,
							length: 10,
							location: 1
						}],
						["Label", {
							label: ite.ConnectionLabelText
						}],
						/*["Custom", {    //自定义overlay为下拉列表
							create: function(component) {
								console.log(component);
								a++;
					
								if (ite.ConnectionSelectText == '语音1') {

									return $("<select id='myDropDown" + a + "' class='myDropDown' style='font-size:12px'> " +
										"<option value='none'>请选择</option>" +
										"<option value='语音1' selected='selected'>语音1</option>" +
										"<option value='语音2'>语音2</option>" +
										+"</select>");
								} else if (ite.ConnectionSelectText == '语音2') {
									return $("<select id='myDropDown" + a + "' class='myDropDown' style='font-size:12px'> " +
										"<option value='none'>请选择</option>" +
										"<option value='语音1' >语音1</option>" +
										"<option value='语音2' selected='selected'>语音2</option>" +
										+"</select>");
								} else if (ite.ConnectionSelectText == '请选择') {
									return $("<select id='myDropDown" + a + "' class='myDropDown' style='font-size:12px'> " +
										"<option value='none' selected='selected'>请选择</option>" +
										"<option value='语音1'>语音1</option>" +
										"<option value='语音2'>语音2</option>" +
										+"</select>");
								}
							},
							location: 0.2,
							id: "customOverlay"
						}]
						*/
					]
				});
			})
		}
	}
}


